import tylerp.dnd.Parser;
import java.util.Scanner;

public class DnDDiceRoller {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String input = "";

        System.out.println("Enter exit, quit, or end to exit the application.");
        System.out.print("Enter your dice roll:  ");
        input = sc.nextLine();
        System.out.println();

        while (!input.toLowerCase().equals("end")
                && !input.toLowerCase().equals("exit")
                && !input.toLowerCase().equals("quit")) {
            try {
                System.out.println(Parser.parse(input));
                System.out.println();
            } catch (java.util.InputMismatchException e) {
                System.out.println("Error. Input string was malformed.");
                System.out.println();
            }
            System.out.print("Enter your dice roll:  ");
            input = sc.nextLine();
            System.out.println();
        }

        System.out.println("Successfully stopped. Goodbye!");
    }
}

